Method: Chef::Version#<=>

Defined in:
lib/chef/version_class.rb

#<=>(other) ⇒ Object

[View source]

35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/chef/version_class.rb', line 35

def <=>(other)
  %i{major minor patch}.each do |method|
    version = send(method)
    begin
      ans = (version <=> other.send(method))
    rescue NoMethodError # if the other thing isn't a version object, return nil
      return nil
    end
    return ans unless ans == 0
  end
  0
end